package com.agu.mgt.example.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.agu.utils.Query;

import java.util.List;
import java.util.Map;

import com.agu.mgt.example.dao.ExmMessageDao;
import com.agu.entity.example.ExmMessageEntity;
import com.agu.mgt.example.service.ExmMessageService;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;


@Service("exmMessageService")
@Transactional(readOnly = true)
public class ExmMessageService{
	@Autowired
	private ExmMessageDao exmMessageDao;
	
	
	public ExmMessageEntity queryObject(Long messageId){
		return exmMessageDao.queryObject(messageId);
	}
	
	
	public List<ExmMessageEntity> queryList(Map<String, Object> map){
		return exmMessageDao.queryList(map);
	}

    
	public Page<ExmMessageEntity> queryPageList(Query query){
	    PageHelper.startPage(query.getPage(), query.getLimit());
	    return exmMessageDao.queryPageList(query);
	}
	
	
	public int queryTotal(Map<String, Object> map){
		return exmMessageDao.queryTotal(map);
	}
	
	
	@Transactional
	public void save(ExmMessageEntity exmMessage){
		exmMessageDao.save(exmMessage);
	}
	
	
	@Transactional
	public void update(ExmMessageEntity exmMessage){
		exmMessageDao.update(exmMessage);
	}
	
	
	@Transactional
	public void delete(Long messageId){
		exmMessageDao.delete(messageId);
	}
	
	
	@Transactional
	public void deleteBatch(Long[] messageIds){
		exmMessageDao.deleteBatch(messageIds);
	}
}
